#pragma once

/*	BitFlags.h
 *
 * Bitmasks dramatically increase cache coherency while keeping the cost for
 * a flag cheap.
 */

// Store our flags in an enum. Preisz and Garney 2011.
#define BIT(X)(1<<x)
enum{
	BITFLAG_RENDER_IS_GEOMETRY_BUNDLE=BIT(0),
	BITFLAG_RENDER_IS_PARCICLE_BUNDLE=BIT(0),
};

// Returns non-zero if true, else false.
#define CHECK_FLAG(X,FLAG)(X & FLAG)

// Returns the bitfield with the flag on.
#define SET_FLAG_ON(X,FLAG)(X | FLAG)

// Returns the bitfield with the flag off.
#define SET_FLAG_OFF(X,FLAG)(X & ~FLAG)

// Example of setting a field to several flags on at once.
// unsigned char field = flag1 | flag2 | flag3 | flag4;